home *** CD-ROM | disk | FTP | other *** search
/ SCI Games E3 2005 Press Kit (USA) / SCI Games E3 2005 Press Kit (USA).bin / runme_mac.swf / scripts / __Packages / mx / controls / streamingmedia / ScreenAccommodator.as < prev    next >
Text File  |  2005-05-05  |  2KB  |  80 lines

  1. class mx.controls.streamingmedia.ScreenAccommodator
  2. {
  3.    var initAction = "nothing";
  4.    function ScreenAccommodator(aContainee)
  5.    {
  6.       this.containee = aContainee;
  7.       this.container = this.getContainingScreen();
  8.       if(this.container != null)
  9.       {
  10.          var _loc2_ = this.container.__get__visible();
  11.          this.beforeInit = false;
  12.          this.container.addEventListener("hide",this);
  13.          this.container.addEventListener("reveal",this);
  14.          if(!_loc2_)
  15.          {
  16.             this.beforeInit = true;
  17.             this.initId = setInterval(this,"disableContainee",50);
  18.          }
  19.       }
  20.    }
  21.    function disableContainee()
  22.    {
  23.       if(this.initAction == "nothing" || this.initAction == "hide")
  24.       {
  25.          mx.controls.streamingmedia.Tracer.trace("ScreenAccommodator.disableContainee: disabling " + this.containee);
  26.          this.containee.enabled = false;
  27.       }
  28.       clearInterval(this.initId);
  29.       this.beforeInit = false;
  30.    }
  31.    function getContainingScreen()
  32.    {
  33.       var _loc4_ = null;
  34.       var _loc3_ = this.containee._parent;
  35.       while(_loc4_ == null && _loc3_ != _root)
  36.       {
  37.          if(_loc3_ instanceof mx.screens.Screen)
  38.          {
  39.             _loc4_ = _loc3_;
  40.          }
  41.          else
  42.          {
  43.             _loc3_ = _loc3_._parent;
  44.          }
  45.       }
  46.       return _loc4_;
  47.    }
  48.    function handleEvent(ev)
  49.    {
  50.       mx.controls.streamingmedia.Tracer.trace("ScreenAccommodator.handleEvent: " + ev.type + " for " + this.containee);
  51.       if(ev.type == "hide")
  52.       {
  53.          if(this.beforeInit)
  54.          {
  55.             this.initAction = "hide";
  56.          }
  57.          else if(this.containee.enabled)
  58.          {
  59.             this.wasAlreadyDisabled = false;
  60.             this.containee.enabled = false;
  61.          }
  62.          else
  63.          {
  64.             this.wasAlreadyDisabled = true;
  65.          }
  66.       }
  67.       else if(ev.type == "reveal")
  68.       {
  69.          if(this.beforeInit)
  70.          {
  71.             this.initAction = "reveal";
  72.          }
  73.          else if(!this.wasAlreadyDisabled && this.containee.visible)
  74.          {
  75.             this.containee.enabled = true;
  76.          }
  77.       }
  78.    }
  79. }
  80.